package cn.xuetian.crm.demo.starter.controller;

import cn.xuetian.crm.demo.starter.config.PassToken;
import cn.xuetian.crm.demo.starter.controller.dto.LoginReqDTO;
//import com.auth0.jwt.JWT;
//import com.auth0.jwt.algorithms.Algorithm;
import java.io.UnsupportedEncodingException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zss
 * @date 2021/11/19 17:40
 * @Email:451682479@qq.com
 */
@RequestMapping("user")
@RestController
public class UserController {

    @PostMapping("/login1")
    public boolean login1(LoginReqDTO user) throws UnsupportedEncodingException {

        return true;
    }


    @PostMapping("/login")
    @PassToken
    public String login(LoginReqDTO user) throws UnsupportedEncodingException {

//        String token = JWT.create().withAudience(user.getAccount())
//            .sign(Algorithm.HMAC256(user.getPassword()));
//
//        return token;

        return "";
    }

}
